
// //请求拦截器
// request.interceptors.request.use(function (config) {
//     Loading.service(options)
//     config.headers.captcha =captcha
//     return config;    
// }),function (error){
//     console.log(error);
// }

// //响应拦截器  
// request.interceptors.request.use(function (response) {
// Loading.service(options).close()
// const headers =response.headers
// if(headers.captcha !=null){
//     captcha = headers.captcha
// }
// return response;
// },function (error){
//     console.log(error);
// });

// return request;
// };
// export default createRequestInstance;
import axios from 'axios';

const baseURL = '/api'
const instance = axios.create({baseURL})

/* const createRequestInstance = () => {
  /* const request = axios.create({
    baseURL: 'http://10.22.7.68:8080/SunshineRun',
    timeout: 5000,
    headers: {
      'Content-Type': 'application/json'
    }
  }); */

  
/* 
  // 请求拦截器
  request.interceptors.request.use(
    config => {
      config.headers['captcha'] = captcha;
      return config;
    },
    error => {
      console.log(error);
      return Promise.reject(error);
    }
  ); */

/*   // 响应拦截器
  request.interceptors.response.use(
    response => {
      const headers = response.headers;
      if (headers.captcha) {
        captcha = headers.captcha;
      }
      return response;
    },
    error => {
      console.log(error);
      return Promise.reject(error);
    }
  );

  return request;
};  */


// instance.interceptors.request.use(
//   config => {
//     config.headers['captcha'] = captcha;
//     return config;
//   },
//   error => {
//     console.log(error);
//     return Promise.reject(error);
//   }
// )

// instance.interceptors.response.use(
//   response => {
//     const headers = response.headers;
//     if (headers.captcha) {
//       captcha = headers.captcha;
//     }
//     return response;
//   },
//   error => {
//     console.log(error);
//     return Promise.reject(error);
//   }
// )




export default instance;
